/**
 * Created by Lenovo on 2017/11/29.
 */
'use strict';
class SmsTmp{
    constructor(){

    }
    //Due date 前3天
    dueBeforeThreeDaySms(money,repayDay){
        return 'Dear Customer, You have a loan of RS'+money+' need to be repaid before '+repayDay+', to avoid overdue charges, please repay now or on time. FlashCash';
    }
    dueBeforeThreeDayPush(){
        return 'Repayment Reminder! Please notice your repayment day is coming! FlashCash';
    }
    dueBeforeThreeDayVoice(){
        return '29875.ivr';
    }

    //Due date 前1天
    dueBeforeOneDaySms(){
      return 'Dear Customer, there is only 1 day left before your repayment date,to avoid overdue charges, please repay now or on time. FlashCash';
    }
    dueBeforeOnePush(){
       return 'Repayment Reminder! There is only 1 day left before your repayment date! FlashCash';
    }
    dueBeforeOneVoice(){
       return '29877.ivr';
    }

    //Due date 当天
    dueTodaySms(repayMoney){
        return 'Dear Customer, You have a loan of RS'+repayMoney+' need to be repaid within today, to avoid overdue charges, please repay on time. FlashCash';
    }
    dueTodayPush(){
        return "You have a loan need to be repaid today. Please make sure it'll be done today! Thank you.FlashCash";
    }
    dueTodayVoice(){
        return '28421.ivr';
    }

    //Overdue 1天
    dueOneDaySms(repayMoney){
       return 'Dear Customer, you have an overdue loan, owed a total of '+repayMoney+' rupees for now, please repay as soon as possible. Please ignore if you have repaid. FlashCash';
    }
    dueOneDayPush(){
       return 'Notice! You have an overdue loan now! FlashCash';
    }
    dueOneDayVoice(){
       return '28423.ivr';
    }

    //Overdue 2天
    dueTwoDaySms(repayMoney){
       return "Dear Customer, you have an overdue loan, owed a total of "+repayMoney+" rupees for now, please repay. Otherwise we'll share this to CRIF bureau. Please ignore if you have repaid. FlashCash";
    }
    dueTwoDayPush(){
       return "Notice! You have an overdue loan now! FlashCash";
    }
    dueTwoDayVoice(){
       return "29879.ivr";
    }

    //Overdue 3天-5天
    dueThreeToFiveDaySms(repayMoney){
        return "Dear Customer, you have an overdue loan, owed a total of "+repayMoney+" rupees for now, please repay. Otherwise we'll report to credit bureau. Please ignore if you have repaid. FlashCash";
    }
    dueThreeToFiveDayPush(){
        return "Notice! You have an overdue loan now! FlashCash";
    }
    dueThreeToFiveDayVoice(){
        return "29881.ivr";
    }

    //Overdue 6天-7天
    dueSixToSevenDaySms(repayMoney){
        return "Dear Customer, you have an overdue loan, owed a total of "+repayMoney+" rupees for now, please repay. Otherwise we'll report to credit bureau and your friends. Please ignore if you have repaid. FlashCash";
    }
    dueSixToSevenDayPush(){
        return "Notice! You have an overdue loan now! FlashCash";
    }
    dueSixToSevenDayVoice(){
        return "29883.ivr";
    }

    //Overdue 8-15天
    dueEightToFivtheenDaySms(repayMoney){
        return "Dear Customer, you have a severely overdue loan, owed a total of "+repayMoney+" rupees for now, please repay. We have reported to credit bureau. Please ignore if you have repaid. FlashCash";
    }
    dueEightToFivtheenDayPush(){
        return "Notice! You have a severely overdue loan now! FlashCash";
    }
    dueEightToFivtheenDayVoice(){
        return "29885.ivr";
    }

    //Overdue 16天以上
    dueMoreSixtheenDaySms(repayMoney){
        return "Dear Customer, you have a severely overdue loan, owed a total of "+repayMoney+" rupees for now, please repay. This do will influence your credit history. Please ignore if you have repaid. FlashCash";
    }
    dueMoreSixtheenDayPush(){
        return "Notice! You have a severely overdue loan now! FlashCash";
    }
    dueMoreSixtheenDayVoice(){
        return "29887.ivr";
    }

    //计算还款日期
    countRepayDate(loanArrayTime,loanPeriod){
        let repayTime=parseInt(loanArrayTime) + parseInt((loanPeriod+1)*24*3600000-24*3600000);
        let date=new Date(repayTime);
        let year=date.getFullYear();
        let month=date.getMonth() + 1;
        let day=date.getDate();
        day = day +"th";
        console.log(loanArrayTime);
        console.log(loanPeriod);
        console.log(year);
        console.log(month);
        console.log(day);
        if(month == 1){
            month="January";
        } else if(month == 2){
            month="February";
        }else if(month == 3){
            month="March";
        }else if(month == 4){
            month="April";
        }else if(month == 5){
            month="May";
        }else if(month == 6){
            month="June";
        }else if(month == 7){
            month="July";
        }else if(month == 8){
            month="August";
        }else if(month == 9){
            month="September";
        }else if(month == 10){
            month="October";
        }else if(month == 11){
            month="November";
        }else if(month == 12){
            month="December";
        }
        return year+" "+month+" "+day;
    }

    //格式化金额
    numFormat(s, n){
        s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
        if (isNaN(s) || ((s + "").replace(/\s/g, "")) == "") {
            return "";
        }
        n = n >= 0 && n <= 20 ? n : 2;
        let l = s.split(".")[0].split("").reverse(), r = s.split(".")[1]?s.split(".")[1]:'';
        let t = "";
        for (let i = 0; i < l.length; i++) {
            t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
        }
        if(r == ''){
            return t.split("").reverse().join("");
        }else{
            return t.split("").reverse().join("") + "." + r;
        }
    }

    //根据时间戳获得当前时间
    getTimeByStime(time){
        let date=new Date(time);
        let year=date.getFullYear();
        let month=date.getMonth() + 1;
        let day=date.getDate();
        day = day +"th";
        console.log(year);
        console.log(month);
        console.log(day);
        if(month == 1){
            month="January";
        } else if(month == 2){
            month="February";
        }else if(month == 3){
            month="March";
        }else if(month == 4){
            month="April";
        }else if(month == 5){
            month="May";
        }else if(month == 6){
            month="June";
        }else if(month == 7){
            month="July";
        }else if(month == 8){
            month="August";
        }else if(month == 9){
            month="September";
        }else if(month == 10){
            month="October";
        }else if(month == 11){
            month="November";
        }else if(month == 12){
            month="December";
        }
        return month+" "+day;
    }

    /**
     * ewi相关催款提醒
     */
     //第一期提醒
        //前一日提醒
          firstRepayBeforeOneDaySms(repayDay){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
          }
          firstRepayBeforeOneDayPush(){
            return "Repayment Reminder! 1 day left before your 1st installment  repayment day!FlashCash.";
          }
          firstRepayBeforeOneDayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
          }
        //还款日当天提醒
          firstRepayTodaySms(){
              return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
          }
          firstRepayTodayPush(){
              return "Repay day! It’s important to repay today! FlashCash."
          }
          firstRepayTodayVoice(){
              return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
          }
        //逾期一天
          firstDueOneDaySms(){
              return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
          }
          firstDueOneDayPush(){
              return "Notice! You have a overdue loan now! FlashCash.";
          }
          firstDueOneDayVoice(){
              return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
          }
        //逾期两天
          firstDueTwoDaySms(){
              return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
          }
          firstDueTwoDayPush(){
              return "Notice! You have a overdue loan now!FlashCash.";
          }
          firstDueTwoDayVoice(){
              return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
          }
    //第二期提醒
         //逾期前一天
        secondRepayBeforeOneDaySms(repayDay){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
        }
        secondRepayBeforeOneDayPush(){
            return "Repayment Reminder! 1 day left before your 1st installment  repayment day!FlashCash.";
        }
        secondRepayBeforeOneDayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
        }
         //逾期当天
        secondRepayTodaySms(){
            return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
        }
        secondRepayTodayPush(){
            return "Repay day! It’s important to repay today! FlashCash."
        }
        secondRepayTodayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
        }
        //逾期一天
        secondDueOneDaySms(){
            return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        secondDueOneDayPush(){
            return "Notice! You have a overdue loan now! FlashCash.";
        }
        secondDueOneDayVoice(){
            return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        //逾期两天
        secondDueTwoDaySms(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        secondDueTwoDayPush(){
            return "Notice! You have a overdue loan now!FlashCash.";
        }
        secondDueTwoDayVoice(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
    //第三期提醒
        //逾期前一天
        thirdRepayBeforeOneDaySms(repayDay){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
        }
        thirdRepayBeforeOneDayPush(){
            return "Repayment Reminder! 1 day left before your 1st installment  repayment day!FlashCash.";
        }
        thirdRepayBeforeOneDayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
        }
        //逾期当天
        thirdRepayTodaySms(){
            return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
        }
        thirdRepayTodayPush(){
            return "Repay day! It’s important to repay today! FlashCash."
        }
        thirdRepayTodayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
        }
        //逾期一天
        thirdDueOneDaySms(){
            return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        thirdDueOneDayPush(){
            return "Notice! You have a overdue loan now! FlashCash.";
        }
        thirdDueOneDayVoice(){
            return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        //逾期两天
        thirdDueTwoDaySms(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        thirdDueTwoDayPush(){
            return "Notice! You have a overdue loan now!FlashCash.";
        }
        thirdDueTwoDayVoice(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
    //第四期提醒
        //逾期前一天
        fourRepayBeforeOneDaySms(repayDay){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
        }
        fourRepayBeforeOneDayPush(){
            return "Repayment Reminder! 1 day left before your 1st installment  repayment day!FlashCash.";
        }
        fourRepayBeforeOneDayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid before "+repayDay+", to avoid overdue charges, please repay on time.FlashCash.";
        }
        //逾期当天
        fourRepayTodaySms(){
            return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
        }
        fourRepayTodayPush(){
            return "Repay day! It’s important to repay today! FlashCash."
        }
        fourRepayTodayVoice(){
            return "Dear Customer, You have a loan installment need to be repaid  today, to avoid overdue charges, please repay on time.FlashCash."
        }
        //逾期一天
        fourDueOneDaySms(){
            return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        fourDueOneDayPush(){
            return "Notice! You have a overdue loan now! FlashCash.";
        }
        fourDueOneDayVoice(){
            return "Dear Customer, you have a overdue loan now, it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        //逾期两天
        fourDueTwoDaySms(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        fourDueTwoDayPush(){
            return "Notice! You have a overdue loan now!FlashCash.";
        }
        fourDueTwoDayVoice(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
     //总的提醒
        //逾期三天
        dueThreeDaySms(totalRepayMoney){
            return "Dear Customer, you EWI loan is overdue now, RS "+totalRepayMoney+" needed to repay as soon as possible ,it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        dueThreeDayPush(){
            return "Overdue! Click here and repay now! FlashCash.";
        }
        dueThreeDayVoice(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        //逾期四天
        dueFourDaySms(totalRepayMoney){
            return "Dear Customer, you EWI loan is overdue now, RS "+totalRepayMoney+" needed to repay as soon as possible ,it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        dueFourDayPush(){
            return "Overdue! Click here and repay now!FlashCash.";
        }
        dueFourDayVoice(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
       //逾期五天
        dueFiveDaySms(totalRepayMoney){
            return "Dear Customer, you EWI loan is overdue now, RS "+totalRepayMoney+" needed to repay as soon as possible ,it cause rs 20 per day before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }
        dueFiveDayPush(){
            return "Overdue! Click here and repay now!FlashCash.";
        }
        dueFiveDayVoice(){
            return "Dear Customer, you have a overdue loan now, it may cause rs 200 before been repaid, please repay as soon as possible. Please ignore if you have repaid.FlashCash.";
        }

}
const smstmp=new SmsTmp();
export default smstmp;
